data1 = (
    (1, 0.08),
    (2, 0.07),
    (3, 0.07),
    (4, 0.07),
    (5, 0.07),
    (6, 0.07),
    (7, 0.07),
    (8, 0.07),
    (9, 0.07),
    (10, 0.07),
    (11, 0.08),
    (12, 0.08),
    (13, 0.08),
    (14, 0.09),
    (15, 0.10),
    (16, 0.09),
    (17, 0.10),
    (18, 0.13),
    (19, 0.16),
    (20, 0.21),
    (21, 0.27),
    (22, 0.36),
)

data2 = (
    (1, 0.04),
    (2, 0.04),
    (3, 0.04),
    (4, 0.04),
    (5, 0.04),
    (6, 0.04),
    (7, 0.04),
    (8, 0.04),
    (9, 0.03),
    (10, 0.02),
    (11, 0.02),
    (12, 0.02),
    (13, 0.02),
    (14, 0.02),
    (15, 0.02),
    (16, 0.02),
    (17, 0.02),
    (18, 0.03),
    (19, 0.03),
    (20, 0.03),
    (21, 0.03),
    (22, 0.03),
)

from matplotlib import pyplot as plt

fig = plt.figure()

x, y = zip(*data1)
plt.plot(x, y, '.-', color='r', linewidth=0.5)

x, y = zip(*data2)
plt.plot(x, y, '.-', color='b', linewidth=0.5)

plt.xlim(0, 23)
plt.ylim(0, 0.5)
plt.xlabel('nbits')
plt.ylabel('time')
plt.legend(['RANDOM', 'GOINGUP'])
plt.savefig('img.png')
